package FunctionalProgram;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class StreamTest {

    public static void main(String[] args) {
        Stream<Integer> stream = Stream.of(1,3,4,56,89);
        Stream<Integer> stream1 = stream.map(n->n*n);
        long startTime = System.currentTimeMillis();
        List<Integer> res = stream1
                .filter(it->it<100)
                .collect(Collectors.toList());
        long endTime = System.currentTimeMillis();
        long duration1 = endTime - startTime;
        System.out.println("duration1 = " + duration1);

        System.out.println("res = " + res.toString());
        long duration2 = endTime - startTime;
        System.out.println("duration2 = " + duration2);
    }
}
